package cn.itcast.order.client;

import cn.itcast.order.client.vo.StorageVO;
import com.pr.config.FeignConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;

/**
 * @author 虎哥
 */
@FeignClient(value = "storage-service",configuration = FeignConfig.class)
public interface StorageClient {
    @PutMapping("/storage/{code}/{count}")
    void deduct(@PathVariable("code") String code, @PathVariable("count") Integer count);

    /**
     * 扣减库存
     * @param commodityCode 商品编号
     * @return 无
     */
    @GetMapping("/storage/{commodityCode}")
    StorageVO getStorageInfoByCommodityCode(@PathVariable("commodityCode") String commodityCode);
}
